package com.select.course.controller;

import com.select.course.service.SchoolCourseService;
import com.select.course.utils.PageUtils;
import com.select.course.utils.R;
import com.select.course.vo.CoursePageVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@CrossOrigin
@RestController
@RequestMapping("/course")
public class SchoolCourseController {


    @Resource
    private SchoolCourseService schoolCourseService;

    @PostMapping("/getselectionall")
    public R getSelectionAll(@RequestBody CoursePageVo coursePageVo) {
        PageUtils pageUtils = schoolCourseService.getSelectionAll(coursePageVo);
        return R.ok().put("data", pageUtils);
    }

    @DeleteMapping("/deletecurri/{id}")
    public R deleteCurri(@PathVariable Long id) {
        boolean b = schoolCourseService.removeById(id);
        if (b) {
            return R.ok();
        }
        return R.error(111, "删除失败！");
    }
}
